#include "dbtabproduct.h"

const QLatin1String DBTabProduct::TAB_NAME = QLatin1String("product");
const char* DBTabProduct::_NAME = "name";
const char* DBTabProduct::_HI = "hi";
const char* DBTabProduct::_OK = "ok";
const char* DBTabProduct::_LOW = "low";

const DBTabProduct::ColumnInfo DBTabProduct::mColumnTab[] =
{
    [INDEX_ID] = {DBTabProduct::_ID,     "integer primary key AUTOINCREMENT"},
    [INDEX_NAME] = {DBTabProduct::_NAME,   "key varchar"},
    [INDEX_HI] = {DBTabProduct::_HI,     "float"},
    [INDEX_OK] = {DBTabProduct::_OK,     "float"},
    [INDEX_LOW] = {DBTabProduct::_LOW,     "float"},
    [INDEX_END] = {nullptr,nullptr}
};

void DBTabProduct::createTab(QSqlDatabase &db)
{qDebug()<<__LINE__;
    DBTabBase::createTab(mTabName,mColumnTab,db);
}

const char *DBTabProduct::getColumnName(int index)
{
    if(index<INDEX_END){
        return mColumnTab[index].columnName;
    }
    return "";
}

DBTabProduct::DBTabProduct():DBTabBase(TAB_NAME)
{

}

